home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Audio / MPEG / staticinit.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-05-06  |  1.8 KB  |  92 lines

  1. /* 
  2.  *  staticinit.cpp
  3.  *
  4.  *  Code from
  5.  *            NekoAmp 1.3 decoder by Avery Lee
  6.  *
  7.  *  FlasKMPEG
  8.  *    Copyright (C) Alberto Vigata - January 2000
  9.  *
  10.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  11.  *    
  12.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  13.  *  it under the terms of the GNU General Public License as published by
  14.  *  the Free Software Foundation; either version 2, or (at your option)
  15.  *  any later version.
  16.  *   
  17.  *  FlasKMPEG is distributed in the hope that it will be useful,
  18.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  *  GNU General Public License for more details.
  21.  *   
  22.  *  You should have received a copy of the GNU General Public License
  23.  *  along with GNU Make; see the file COPYING.  If not, write to
  24.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  25.  *
  26.  */
  27.  
  28.  
  29. #include <math.h>
  30. #include <float.h>
  31.  
  32. #include "AMPDecoder.h"
  33.  
  34. int AMPDecoder::init_count = 0;
  35.  
  36. signed char AMPDecoder::group3[31][3];
  37. signed char AMPDecoder::group5[127][3];
  38. signed char AMPDecoder::group9[1023][3];
  39.  
  40. signed char (*AMPDecoder::group_tbls[3])[3]={
  41.     group3,
  42.     group5,
  43.     group9,
  44. };
  45.  
  46. extern void init_mdct();
  47.  
  48. void AMPDecoder::Initialize()
  49. {
  50.     int i,j;
  51.     int v;
  52.  
  53.     if (init_count)
  54.         return;
  55.  
  56.     ++init_count;
  57.  
  58.     // initialize IMDCT for layer 3 decoding
  59.  
  60.     init_mdct();
  61.  
  62.     // initialize 3/5/9 group decoding tables for layer 2
  63.  
  64.     for(i=0; i<31; i++) {
  65.         v = i;
  66.  
  67.         for(j=0; j<3; j++) {
  68.             group3[i][j] = v % 3 - 1;
  69.             v /= 3;
  70.         }
  71.     }
  72.  
  73.     for(i=0; i<127; i++) {
  74.         v = i;
  75.  
  76.         for(j=0; j<3; j++) {
  77.             group5[i][j] = v % 5 - 2;
  78.             v /= 5;
  79.         }
  80.     }
  81.  
  82.     for(i=0; i<1023; i++) {
  83.         v = i;
  84.  
  85.         for(j=0; j<3; j++) {
  86.             group9[i][j] = v % 9 - 4;
  87.             v /= 9;
  88.         }
  89.     }
  90.  
  91. }
  92.